package eerbaar.v2.app;

import eerbaar.game.IGame;
import eerbaar.shared.service.ServiceFactory;

public class GameHelper {

    public static IGame getGame() {

        IGameStorage gameStorage = ServiceFactory
                .getService(IGameStorage.class);
        if (gameStorage == null) {
            return null;
        }

        return gameStorage.getGame();
    }

    public static void register(IGameStorage gameStorage) {

        ServiceFactory.register(IGameStorage.class, gameStorage);
    }

    public static void setGame(IGame game) {

        IGameStorage gameStorage = ServiceFactory
                .getService(IGameStorage.class);
        gameStorage.setGame(game);
    }
}